home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / src / ov-base.cc < prev    next >
C/C++ Source or Header  |  1996-11-10  |  6KB  |  262 lines

  1. /*
  2.  
  3. Copyright (C) 1996 John W. Eaton
  4.  
  5. This file is part of Octave.
  6.  
  7. Octave is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Octave; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. */
  22.  
  23. #if defined (__GNUG__)
  24. #pragma implementation
  25. #endif
  26.  
  27. #ifdef HAVE_CONFIG_H
  28. #include <config.h>
  29. #endif
  30.  
  31. #include "lo-ieee.h"
  32.  
  33. #include "gripes.h"
  34. #include "oct-map.h"
  35. #include "ops.h"
  36. #include "ov-base.h"
  37. #include "ov-scalar.h"
  38. #include "ov-re-mat.h"
  39. #include "ov-complex.h"
  40. #include "ov-cx-mat.h"
  41. #include "ov-ch-mat.h"
  42. #include "ov-str-mat.h"
  43. #include "ov-range.h"
  44.  
  45. int octave_base_value::t_id = -1;
  46.  
  47. const string octave_base_value::t_name ("<unknown type>");
  48.  
  49. octave_value
  50. octave_base_value::index (const octave_value_list&) const
  51. {
  52.   string nm = type_name ();
  53.   error ("can't perform indexing operations for %s type", nm.c_str ());
  54.   return octave_value ();
  55. }
  56.  
  57. idx_vector
  58. octave_base_value::index_vector (void) const
  59. {
  60.   string nm = type_name ();
  61.   error ("%s type invalid as index value", nm.c_str ());
  62.   return idx_vector ();
  63. }
  64.  
  65. octave_value
  66. octave_base_value::struct_elt_val (const string&, bool) const
  67. {
  68.   string nm = type_name ();
  69.   error ("can't perform structure reference operations for %s type",
  70.      nm.c_str ());
  71.   return octave_value ();
  72. }
  73.  
  74. octave_value&
  75. octave_base_value::struct_elt_ref (const string&)
  76. {
  77.   static octave_value foo;
  78.   string nm = type_name ();
  79.   error ("can't perform structure reference operations for %s type",
  80.      nm.c_str ());
  81.   return foo;
  82. }
  83.  
  84. octave_value
  85. octave_base_value::convert_to_str (void) const
  86. {
  87.   gripe_wrong_type_arg ("octave_base_value::convert_to_str ()",
  88.             type_name ());
  89.   return octave_value ();
  90. }
  91.  
  92. void
  93. octave_base_value::convert_to_row_or_column_vector (void)
  94. {
  95.   gripe_wrong_type_arg
  96.     ("octave_base_value::convert_to_row_or_column_vector ()",
  97.      type_name ());
  98. }
  99.  
  100. void
  101. octave_base_value::print (ostream&, bool)
  102. {
  103.   gripe_wrong_type_arg ("octave_base_value::print()", type_name ());
  104. }
  105.  
  106. double
  107. octave_base_value::double_value (bool) const
  108. {
  109.   double retval = octave_NaN;
  110.   gripe_wrong_type_arg ("octave_base_value::double_value ()", type_name ());
  111.   return retval;
  112. }
  113.  
  114. Matrix
  115. octave_base_value::matrix_value (bool) const
  116. {
  117.   Matrix retval;
  118.   gripe_wrong_type_arg ("octave_base_value::matrix_value()", type_name ());
  119.   return retval;
  120. }
  121.  
  122. Complex
  123. octave_base_value::complex_value (bool) const
  124. {
  125.   Complex retval (octave_NaN, octave_NaN);
  126.   gripe_wrong_type_arg ("octave_base_value::complex_value()", type_name ());
  127.   return retval;
  128. }
  129.  
  130. ComplexMatrix
  131. octave_base_value::complex_matrix_value (bool) const
  132. {
  133.   ComplexMatrix retval;
  134.   gripe_wrong_type_arg ("octave_base_value::complex_matrix_value()",
  135.             type_name ());
  136.   return retval;
  137. }
  138.  
  139. charMatrix
  140. octave_base_value::char_matrix_value (bool) const
  141. {
  142.   charMatrix retval;
  143.   gripe_wrong_type_arg ("octave_base_value::char_matrix_value()",
  144.             type_name ());
  145.   return retval;
  146. }
  147.  
  148. string_vector
  149. octave_base_value::all_strings (void) const
  150. {
  151.   string_vector retval;
  152.   gripe_wrong_type_arg ("octave_base_value::all_strings()", type_name ());
  153.   return retval;
  154. }
  155.  
  156. string
  157. octave_base_value::string_value (void) const
  158. {
  159.   string retval;
  160.   gripe_wrong_type_arg ("octave_base_value::string_value()", type_name ());
  161.   return retval;
  162. }
  163.  
  164. Range
  165. octave_base_value::range_value (void) const
  166. {
  167.   Range retval;
  168.   gripe_wrong_type_arg ("octave_base_value::range_value()", type_name ());
  169.   return retval;
  170. }
  171.  
  172. Octave_map
  173. octave_base_value::map_value (void) const
  174. {
  175.   Octave_map retval;
  176.   gripe_wrong_type_arg ("octave_base_value::map_value()", type_name ());
  177.   return retval;
  178. }
  179.  
  180. octave_value
  181. octave_base_value::not (void) const
  182. {
  183.   octave_value retval;
  184.   gripe_wrong_type_arg ("octave_base_value::not()", type_name ());
  185.   return retval;
  186. }
  187.  
  188. octave_value
  189. octave_base_value::uminus (void) const
  190. {
  191.   octave_value retval;
  192.   gripe_wrong_type_arg ("octave_base_value::uminus()", type_name ());
  193.   return retval;
  194. }
  195.  
  196. octave_value
  197. octave_base_value::transpose (void) const
  198. {
  199.   octave_value retval;
  200.   gripe_wrong_type_arg ("octave_base_value::transpose()", type_name ());
  201.   return retval;
  202. }
  203.  
  204. octave_value
  205. octave_base_value::hermitian (void) const
  206. {
  207.   octave_value retval;
  208.   gripe_wrong_type_arg ("octave_base_value::hermitian()", type_name ());
  209.   return retval;
  210. }
  211.  
  212. void
  213. octave_base_value::increment (void)
  214. {
  215.   gripe_wrong_type_arg ("octave_base_value::increment()", type_name ());
  216. }
  217.  
  218. void
  219. octave_base_value::decrement (void)
  220. {
  221.   gripe_wrong_type_arg ("octave_base_value::decrement()", type_name ());
  222. }
  223.  
  224. static octave_value *
  225. matrix_conv (const octave_value&)
  226. {
  227.   return new octave_matrix ();
  228. }
  229.  
  230. static octave_value *
  231. complex_matrix_conv (const octave_value&)
  232. {
  233.   return new octave_complex_matrix ();
  234. }
  235.  
  236. static octave_value *
  237. string_conv (const octave_value&)
  238. {
  239.   return new octave_char_matrix_str ();
  240. }
  241.  
  242. void
  243. install_base_type_conversions (void)
  244. {
  245.   INSTALL_ASSIGNCONV (octave_base_value, octave_scalar, octave_matrix);
  246.   INSTALL_ASSIGNCONV (octave_base_value, octave_matrix, octave_matrix);
  247.   INSTALL_ASSIGNCONV (octave_base_value, octave_complex, octave_complex_matrix);
  248.   INSTALL_ASSIGNCONV (octave_base_value, octave_complex_matrix, octave_complex_matrix);
  249.   INSTALL_ASSIGNCONV (octave_base_value, octave_range, octave_matrix);
  250.   INSTALL_ASSIGNCONV (octave_base_value, octave_char_matrix_str, octave_char_matrix_str);
  251.  
  252.   INSTALL_WIDENOP (octave_base_value, octave_matrix, matrix_conv);
  253.   INSTALL_WIDENOP (octave_base_value, octave_complex_matrix, complex_matrix_conv);
  254.   INSTALL_WIDENOP (octave_base_value, octave_char_matrix_str, string_conv);
  255. }
  256.  
  257. /*
  258. ;;; Local Variables: ***
  259. ;;; mode: C++ ***
  260. ;;; End: ***
  261. */
  262.